from django import forms
from apps.user.models import User


class RegisterForm(forms.ModelForm):
    class Meta:
        model = User
        fields = {'email', 'user_name', 'password', "mobile_phone"}
        error_messages = {
            "user_name": {"required": "昵称必须输入"},
            "password": {"required": "请输入密码"},
            "email": {"required": "请输入有效的邮箱"},
            "mobile_phone": {"required": "请输入有效的电话号码"}
        }


class LoginForm(forms.Form):
    user_name = forms.CharField(label="昵称", error_messages={"required": "请输入邮箱或昵称"})
    password = forms.CharField(label="密码", error_messages={"required": "请输入密码"})
